{include file=member.header.html}
<style>
    .borline td { padding:10px 0px; }
    .ware_list th { text-align:left; }
.image_mask{top:0;left:0;z-index:999}
#logo_mask{width:120px;height:120px}
</style>
<script type="text/javascript">
    $(function() {
    	$.validator.addMethod("isIdCardNo", function (value, element) {
			return this.optional(element) || isIdCardNo(value);  
		}, "请正确输入您的身份证号码");
    	
        $('#profile_form').validate({
            errorPlacement: function(error, element) {
                $(element).parent('span').parent('b').after(error);
            },
            rules: {
                portrait: {
                    accept: 'gif|jpe?g|png'
                },
                user_no: {
                	isIdCardNo : $("input[name='user_no']").val(),
                    required:true
                },
                real_name: {
                    required:true
                },
                phone_mob: {
                    required:true
                }
            },
            messages: {
                portrait: {
                    accept: '{$lang.avatar}'
                },
                user_no: {
                    required: '身份证不能为空'
                },
                real_name: {
                    required: '姓名不能为空'
                },
                phone_mob: {
                    required: '手机号不能为空'
                }
                
            }
        });
        $('input[ectype="change_avatar"]').change(function() {
			if($(this).val()){
				$("#logo_mask").attr('style','background:url({res file=images/logo_mask.png})');
			}else{
				$("#logo_mask").removeAttr('style');
			}
            $('input[ectype="change_avatar"]').removeAttr('name');
            $(this).attr('name', 'portrait');
        });
    });
    
    //增加身份证验证
function isIdCardNo(num){
    　   //if (isNaN(num)) {alert("输入的不是数字！"); return false;}
    　　 var len = num.length, re;
    　　 if (len == 15) 
    　　 re = new RegExp(/^(\d{6})()?(\d{2})(\d{2})(\d{2})(\d{2})(\w)$/); 
    　　 else if (len == 18) 
    　　 re = new RegExp(/^(\d{6})()?(\d{4})(\d{2})(\d{2})(\d{3})(\w)$/); 
    　　 else {
            //alert("输入的数字位数不对。"); 
            return false;
        } 
    　　 var a = num.match(re); 
    　　 if (a != null) 
    　　 { 
    　　 if (len==15) 
    　　 { 
    　　 var D = new Date("19"+a[3]+"/"+a[4]+"/"+a[5]); 
    　　 var B = D.getYear()==a[3]&&(D.getMonth()+1)==a[4]&&D.getDate()==a[5]; 
    　　 } 
    　　 else 
    　　 { 
    　　 var D = new Date(a[3]+"/"+a[4]+"/"+a[5]); 
    　　 var B = D.getFullYear()==a[3]&&(D.getMonth()+1)==a[4]&&D.getDate()==a[5]; 
    　　 } 
    　　 if (!B) {
            //alert("输入的身份证号 "+ a[0] +" 里出生日期不对。"); 
            return false;
        } 
    　　 } 
    　　 if(!re.test(num)){
            //alert("身份证最后一位只能是数字和字母。");
            return false;
        }
    　　 return true; 
    }
</script>
<div class="content">
    {include file=member.menu.html}
    <div id="right">
        {include file=member.curlocal.html}
        {include file=member.submenu.html}
        <div class="wrap">
            <div class="public">
                <form method="post" enctype="multipart/form-data" id="profile_form">
                    <div class="information">
                        <!--{if !$edit_avatar}-->
                        <div class="photo width13">
                            <div class="relative"><div class="absolute image_mask" id="logo_mask"></div><img src="<!--{if $profile.portrait}-->{$profile.portrait}?{$random_number}<!--{else}-->{$site_url}/data/system/default_user_portrait.gif<!--{/if}-->" width="120" height="120" alt="" ectype="avatar" /></div>
                            <b>
                                <span class="file1"><input type="file" size="1" maxlength="0" hidefocus="true" ectype="change_avatar" name="portrait1" /></span>
                                <span class="file2"><input type="file" size="1" maxlength="0" hidefocus="true" ectype="change_avatar" name="portrait2" /></span>
                                <div class="txt">{$lang.change_portrait}</div>
                            </b>
                        </div>
                        <!--{/if}-->
                        <div class="info individual">
                            <table>
                                <tr>
                                    <th class="width4">{$lang.user_name}: </th>
                                    <td>{$profile.user_name|escape}</td>
                                </tr>
                                <tr>
                                    <th>{$lang.email}:</th>
                                    <td>{$profile.email}</td>
                                </tr>
                                <tr>
                                    <th>{$lang.real_name}:</th>
                                    <td><b><span><input type="text" class="text width_normal" name="real_name" value="{$profile.real_name|escape}" /></span></b></td>
                                </tr>
                                <!--lichen 2019/4/10 start-->
                                <tr>
                                    <th>{$lang.user_no}:</th>
                                    <td><b><span><input type="text" class="text width_normal" name="user_no" value="{$profile.user_no|escape}" /></span></b></td>
                                </tr>
                                <tr>
                                    <th>{$lang.phone_mob}:</th>
                                    <td>{$profile.phone_mob}</td>
                                </tr>
                                <!--lichen 2019/4/10 end-->
                                <tr>
                                    <th>{$lang.gender}: </th>
                                    <td class="label">
                                        <label>
                                            <input type="radio" name="gender" value="0" {if $profile.gender eq 0}checked="checked"{/if} />{$lang.unknown}  </label>
                                        <label>
                                            <input type="radio" name="gender" value="1" {if $profile.gender eq 1}checked="checked"{/if} />{$lang.male}   </label>
                                        <label>
                                            <input type="radio" name="gender" value="2" {if $profile.gender eq 2}checked="checked"{/if} />{$lang.female} </label>
                                    </td>
                                </tr>
                                <tr>
                                    <th>{$lang.birthday}: </th>
                                    <td>
                                        <input type="text" class="text width_normal" name="birthday" id="birthday" value="{$profile.birthday|escape}" />
                                    </td>
                                </tr>
                                <tr>
                                    <th>{$lang.im_qq}:</th>
                                    <td> <input type="text" class="text width_normal" name="im_qq" value="{$profile.im_qq|escape}" /></td>
                                </tr>
                                <!--{if $edit_avatar}-->
                                <tr>
                                    <th>{$lang.portrait}:</th>
                                    <td>{$edit_avatar}</td>
                                </tr>
                                <!--{/if}-->
                                <tr>
                                    <th></th>
                                    <td><input type="submit" class="btn" value="{$lang.save_edit}" /></td>
                                </tr>
                            </table>
                        </div>
                    </div>
                </form>
            </div>
        </div>
        <div class="clear"></div>
    </div>
    <div class="clear"></div>
</div>
{include file=footer.html}
